using System;
using System.Collections.Generic;


namespace DataObjects
{
	[Serializable]
	public class Employee: IEquatable<Employee>
	{

		#region Private Members

		private string _employee_id; 
		private string _first_name; 
		private string _last_name; 
		private string _department_id; 
		private string _position_id; 
		private string _gender; 
		private string _nationality; 
		private DateTime? _birthday; 
		private string _address_resident; 
		private string _address_temporary; 
		private string _phone_home; 
		private string _phone_mobile; 
		private string _phone_work; 
		private string _phone_extension; 
		private string _email_personal; 
		private string _email_work; 
		private string _education; 
		private string _image_path; 
		private string _bank_account; 
		private string _bank_code; 
		private string _remark; 
		private string _status; 		
		#endregion

		#region Constructor

		public Employee()
		{
			_employee_id = String.Empty; 
			_first_name = String.Empty; 
			_last_name = String.Empty; 
			_department_id = String.Empty; 
			_position_id = String.Empty; 
			_gender = String.Empty; 
			_nationality = String.Empty; 
			_birthday = new DateTime?(); 
			_address_resident = String.Empty; 
			_address_temporary = String.Empty; 
			_phone_home = String.Empty; 
			_phone_mobile = String.Empty; 
			_phone_work = String.Empty; 
			_phone_extension = String.Empty; 
			_email_personal = String.Empty; 
			_email_work = String.Empty; 
			_education = String.Empty; 
			_image_path = String.Empty; 
			_bank_account = String.Empty; 
			_bank_code = String.Empty; 
			_remark = String.Empty; 
			_status = String.Empty; 
		}
		#endregion // End of Default ( Empty ) Class Constuctor

		#region Required Fields Only Constructor
		/// <summary>
		/// required (not null) fields only constructor
		/// </summary>
		public Employee(
			string employee_id)
			: this()
		{
			_employee_id = employee_id;
			_first_name = String.Empty;
			_last_name = String.Empty;
			_department_id = String.Empty;
			_position_id = String.Empty;
			_gender = String.Empty;
			_nationality = String.Empty;
			_birthday = null;
			_address_resident = String.Empty;
			_address_temporary = String.Empty;
			_phone_home = String.Empty;
			_phone_mobile = String.Empty;
			_phone_work = String.Empty;
			_phone_extension = String.Empty;
			_email_personal = String.Empty;
			_email_work = String.Empty;
			_education = String.Empty;
			_image_path = String.Empty;
			_bank_account = String.Empty;
			_bank_code = String.Empty;
			_remark = String.Empty;
			_status = String.Empty;
		}
		#endregion // End Constructor

		#region Public Properties
			
		public virtual string EmployeeId
		{
			get
			{ 
				return _employee_id;
			}

			set	
			{	
				if( value == null )
					throw new ArgumentOutOfRangeException("Null value not allowed for EmployeeId", value, "null");
				
				if(  value.Length > 10)
					throw new ArgumentOutOfRangeException("Invalid value for EmployeeId", value, value.ToString());
				
				_employee_id = value;
			}
		}
			
		public virtual string FirstName
		{
			get
			{ 
				return _first_name;
			}

			set	
			{	
				if(  value != null &&  value.Length > 50)
					throw new ArgumentOutOfRangeException("Invalid value for FirstName", value, value.ToString());
				
				_first_name = value;
			}
		}
			
		public virtual string LastName
		{
			get
			{ 
				return _last_name;
			}

			set	
			{	
				if(  value != null &&  value.Length > 50)
					throw new ArgumentOutOfRangeException("Invalid value for LastName", value, value.ToString());
				
				_last_name = value;
			}
		}
			
		public virtual string DepartmentId
		{
			get
			{ 
				return _department_id;
			}

			set	
			{	
				if(  value != null &&  value.Length > 10)
					throw new ArgumentOutOfRangeException("Invalid value for DepartmentId", value, value.ToString());
				
				_department_id = value;
			}
		}
			
		public virtual string PositionId
		{
			get
			{ 
				return _position_id;
			}

			set	
			{	
				if(  value != null &&  value.Length > 10)
					throw new ArgumentOutOfRangeException("Invalid value for PositionId", value, value.ToString());
				
				_position_id = value;
			}
		}
			
		public virtual string Gender
		{
			get
			{ 
				return _gender;
			}

			set	
			{	
				if(  value != null &&  value.Length > 10)
					throw new ArgumentOutOfRangeException("Invalid value for Gender", value, value.ToString());
				
				_gender = value;
			}
		}
			
		public virtual string Nationality
		{
			get
			{ 
				return _nationality;
			}

			set	
			{	
				if(  value != null &&  value.Length > 10)
					throw new ArgumentOutOfRangeException("Invalid value for Nationality", value, value.ToString());
				
				_nationality = value;
			}
		}
			
		public virtual DateTime? Birthday
		{
			get
			{ 
				return _birthday;
			}
			set
			{
				_birthday = value;
			}

		}
			
		public virtual string AddressResident
		{
			get
			{ 
				return _address_resident;
			}

			set	
			{	
				if(  value != null &&  value.Length > 200)
					throw new ArgumentOutOfRangeException("Invalid value for AddressResident", value, value.ToString());
				
				_address_resident = value;
			}
		}
			
		public virtual string AddressTemporary
		{
			get
			{ 
				return _address_temporary;
			}

			set	
			{	
				if(  value != null &&  value.Length > 200)
					throw new ArgumentOutOfRangeException("Invalid value for AddressTemporary", value, value.ToString());
				
				_address_temporary = value;
			}
		}
			
		public virtual string PhoneHome
		{
			get
			{ 
				return _phone_home;
			}

			set	
			{	
				if(  value != null &&  value.Length > 50)
					throw new ArgumentOutOfRangeException("Invalid value for PhoneHome", value, value.ToString());
				
				_phone_home = value;
			}
		}
			
		public virtual string PhoneMobile
		{
			get
			{ 
				return _phone_mobile;
			}

			set	
			{	
				if(  value != null &&  value.Length > 50)
					throw new ArgumentOutOfRangeException("Invalid value for PhoneMobile", value, value.ToString());
				
				_phone_mobile = value;
			}
		}
			
		public virtual string PhoneWork
		{
			get
			{ 
				return _phone_work;
			}

			set	
			{	
				if(  value != null &&  value.Length > 50)
					throw new ArgumentOutOfRangeException("Invalid value for PhoneWork", value, value.ToString());
				
				_phone_work = value;
			}
		}
			
		public virtual string PhoneExtension
		{
			get
			{ 
				return _phone_extension;
			}

			set	
			{	
				if(  value != null &&  value.Length > 50)
					throw new ArgumentOutOfRangeException("Invalid value for PhoneExtension", value, value.ToString());
				
				_phone_extension = value;
			}
		}
			
		public virtual string EmailPersonal
		{
			get
			{ 
				return _email_personal;
			}

			set	
			{	
				if(  value != null &&  value.Length > 50)
					throw new ArgumentOutOfRangeException("Invalid value for EmailPersonal", value, value.ToString());
				
				_email_personal = value;
			}
		}
			
		public virtual string EmailWork
		{
			get
			{ 
				return _email_work;
			}

			set	
			{	
				if(  value != null &&  value.Length > 50)
					throw new ArgumentOutOfRangeException("Invalid value for EmailWork", value, value.ToString());
				
				_email_work = value;
			}
		}
			
		public virtual string Education
		{
			get
			{ 
				return _education;
			}

			set	
			{	
				if(  value != null &&  value.Length > 10)
					throw new ArgumentOutOfRangeException("Invalid value for Education", value, value.ToString());
				
				_education = value;
			}
		}
			
		public virtual string ImagePath
		{
			get
			{ 
				return _image_path;
			}

			set	
			{	
				if(  value != null &&  value.Length > 200)
					throw new ArgumentOutOfRangeException("Invalid value for ImagePath", value, value.ToString());
				
				_image_path = value;
			}
		}
			
		public virtual string BankAccount
		{
			get
			{ 
				return _bank_account;
			}

			set	
			{	
				if(  value != null &&  value.Length > 50)
					throw new ArgumentOutOfRangeException("Invalid value for BankAccount", value, value.ToString());
				
				_bank_account = value;
			}
		}
			
		public virtual string BankCode
		{
			get
			{ 
				return _bank_code;
			}

			set	
			{	
				if(  value != null &&  value.Length > 10)
					throw new ArgumentOutOfRangeException("Invalid value for BankCode", value, value.ToString());
				
				_bank_code = value;
			}
		}
			
		public virtual string Remark
		{
			get
			{ 
				return _remark;
			}

			set	
			{	
				if(  value != null &&  value.Length > 200)
					throw new ArgumentOutOfRangeException("Invalid value for Remark", value, value.ToString());
				
				_remark = value;
			}
		}
			
		public virtual string Status
		{
			get
			{ 
				return _status;
			}

			set	
			{	
				if(  value != null &&  value.Length > 10)
					throw new ArgumentOutOfRangeException("Invalid value for Status", value, value.ToString());
				
				_status = value;
			}
		}
			
				
		#endregion 

		#region Public Functions

		#endregion //Public Functions

		#region Equals And HashCode Overrides
		/// <summary>
		/// local implementation of Equals based on unique value members
		/// </summary>
		public override bool Equals( object obj )
		{
			if( this == obj ) return true;
			if( ( obj == null ) || ( obj.GetType() != this.GetType() ) ) return false;
			Employee castObj = (Employee)obj; 
			return ( castObj != null ) &&
				( this._employee_id == castObj.EmployeeId );
		}
		
		/// <summary>
		/// local implementation of GetHashCode based on unique value members
		/// </summary>
		public override int GetHashCode()
		{
			
			int hash = 57; 
			hash = 27 ^ hash ^ _employee_id.GetHashCode();
			return hash; 
		}
		#endregion
		
		#region IEquatable members

		public bool Equals(Employee other)
		{
			if (other == this)
				return true;
		
			return ( other != null ) &&
				( this._employee_id == other.EmployeeId );
				   
		}

		#endregion
		
	}
}
